package cs.rsa.ts14.lima;

import java.util.StringTokenizer;

public final class Util {
	/**
	 * Split a line into an array of tokens, whitespace is delimiter.
	 * 
	 * @param line
	 *            the line to split
	 * @return array of tokens in the line
	 */
	public static String[] buildTokenArray(String line) {
		String[] tokenList;
		StringTokenizer tokenizer = new StringTokenizer(line);
		tokenList = new String[tokenizer.countTokens()];
		int i = 0;
		while (tokenizer.hasMoreTokens()) {
			tokenList[i] = tokenizer.nextToken();
			i++;
		}
		return tokenList;
	}

	public static boolean isAlpha(String name) {
		return name.matches("[a-zA-Z]+");
	}
}
